package com.wise.service.local.content.code;

import com.wise.model.content.utils.GetCodeFromCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;


@Service
@SummerService
@Slf4j
public class GetCodeFromCacheService implements SummerServiceBean<GetCodeFromCache> {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @Override
    public void sum(GetCodeFromCache summer) {
        String code= redisTemplate.opsForValue().get(summer.getKey());
        log.info("===============到redis中查找验证码是否存在code:{}，key:{}=============",code,summer.getKey());
        summer.setSummerResult(code);
    }
}
